package com.common.help.test08;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.ServerSocket;
import java.net.Socket;

public class ServerSocket1{
	public static final int port = 8888;
	public static void main(String[] args) throws IOException {
		ServerSocket server  = new ServerSocket(port);
		Socket socket = server.accept();
		BufferedReader br = new BufferedReader(new InputStreamReader(socket.getInputStream()));
		
		StringBuffer sb = new StringBuffer();
		String line = "";
		while(true){
			line = br.readLine();
			if(!line.equals("END")){
				sb.append(line);
			}else{
				break;
			}
		}
		System.err.println("服务端--->"+sb.toString());
		server.close();
		socket.close();
		br.close();
	}
}
